package com.ydcloud.${packageName}.domain.criteria;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/*********************************************************************************************************
 * Copyright (c) 
 * All rights reserved.
 *
 * 文件名称:public class ${jName}{ } 
 * 
 * 摘    要： 
 * 版    本：1.0
 * 作    者：${createBy}
 * 创建于：${createDate}
 * 最后修改时间：
 * 
*********************************************************************************************************/
public class ${jName}Criteria{
	protected String orderByClause;

    protected boolean distinct;

    protected List<Criteria> oredCriteria;

    private Integer limit;

    private Integer offset;

    public ${jName}Criteria() {
        oredCriteria = new ArrayList<Criteria>();
    }

    public void setOrderByClause(String orderByClause) {
        this.orderByClause = orderByClause;
    }

    public String getOrderByClause() {
        return orderByClause;
    }

    public void setDistinct(boolean distinct) {
        this.distinct = distinct;
    }

    public boolean isDistinct() {
        return distinct;
    }

    public List<Criteria> getOredCriteria() {
        return oredCriteria;
    }

    public void or(Criteria criteria) {
        oredCriteria.add(criteria);
    }

    public Criteria or() {
        Criteria criteria = createCriteriaInternal();
        oredCriteria.add(criteria);
        return criteria;
    }

    public Criteria createCriteria() {
        Criteria criteria = createCriteriaInternal();
        if (oredCriteria.size() == 0) {
            oredCriteria.add(criteria);
        }
        return criteria;
    }

    protected Criteria createCriteriaInternal() {
        Criteria criteria = new Criteria();
        return criteria;
    }

    public void clear() {
        oredCriteria.clear();
        orderByClause = null;
        distinct = false;
    }

    public void setLimit(Integer limit) {
        this.limit = limit;
    }

    public Integer getLimit() {
        return limit;
    }

    public void setOffset(Integer offset) {
        this.offset = offset;
    }

    public Integer getOffset() {
        return offset;
    }

    protected abstract static class GeneratedCriteria {
        protected List<Criterion> criteria;

        protected GeneratedCriteria() {
            super();
            criteria = new ArrayList<Criterion>();
        }

        public boolean isValid() {
            return criteria.size()${r" >"} 0;
        }

        public List<Criterion> getAllCriteria() {
            return criteria;
        }

        public List<Criterion> getCriteria() {
            return criteria;
        }

        protected void addCriterion(String condition) {
            if (condition == null) {
                throw new RuntimeException("Value for condition cannot be null");
            }
            criteria.add(new Criterion(condition));
        }

        protected void addCriterion(String condition, Object value, String property) {
            if (value == null) {
                throw new RuntimeException("Value for " + property + " cannot be null");
            }
            criteria.add(new Criterion(condition, value));
        }

        protected void addCriterion(String condition, Object value1, Object value2, String property) {
            if (value1 == null || value2 == null) {
                throw new RuntimeException("Between values for " + property + " cannot be null");
            }
            criteria.add(new Criterion(condition, value1, value2));
        }
        
        public Criteria and${jKey["jFname"]}IsNull() {
            addCriterion("${jKey["sName"]} is null");
            return (Criteria) this;
        }

        public Criteria and${jKey["jFname"]}IsNotNull() {
            addCriterion("${jKey["sName"]} is not null");
            return (Criteria) this;
        }

        public Criteria and${jKey["jFname"]}EqualTo(${jKey["jType"]} value) {
            addCriterion("${jKey["sName"]} =", value, "${jKey["jName"]}");
            return (Criteria) this;
        }

        public Criteria andIdNotEqualTo(Long value) {
            addCriterion("${jKey["sName"]} ${r"<>"}", value, "${jKey["jName"]}");
            return (Criteria) this;
        }

        public Criteria and${jKey["jFname"]}GreaterThan(${jKey["jType"]} value) {
            addCriterion("${jKey["sName"]}${r" >"}", value, "${jKey["jName"]}");
            return (Criteria) this;
        }

        public Criteria and${jKey["jFname"]}GreaterThanOrEqualTo(${jKey["jType"]} value) {
            addCriterion("${jKey["sName"]}${r" >"}=", value, "${jKey["jName"]}");
            return (Criteria) this;
        }

        public Criteria and${jKey["jFname"]}LessThan(${jKey["jType"]} value) {
            addCriterion("${jKey["sName"]}${r" <"}", value, "${jKey["jName"]}");
            return (Criteria) this;
        }

        public Criteria and${jKey["jFname"]}LessThanOrEqualTo(${jKey["jType"]} value) {
            addCriterion("${jKey["sName"]}${r" <"}=", value, "${jKey["jName"]}");
            return (Criteria) this;
        }

        public Criteria and${jKey["jFname"]}In(List<${jKey["jType"]}> values) {
            addCriterion("${jKey["sName"]} in", values, "${jKey["jName"]}");
            return (Criteria) this;
        }

        public Criteria and${jKey["jFname"]}NotIn(List<${jKey["jType"]}> values) {
            addCriterion("${jKey["sName"]} not in", values, "${jKey["jName"]}");
            return (Criteria) this;
        }

        public Criteria and${jKey["jFname"]}Between(${jKey["jType"]} value1, ${jKey["jType"]} value2) {
            addCriterion("${jKey["sName"]} between", value1, value2, "${jKey["jName"]}");
            return (Criteria) this;
        }

        public Criteria and${jKey["jFname"]}NotBetween(${jKey["jType"]} value1, ${jKey["jType"]} value2) {
            addCriterion("${jKey["sName"]} not between", value1, value2, "${jKey["jName"]}");
            return (Criteria) this;
        }

		<#list paramList as param>
        
        public Criteria and${param["jFname"]}IsNull() {
            addCriterion("${param["sName"]} is null");
            return (Criteria) this;
        }

        public Criteria and${param["jFname"]}IsNotNull() {
            addCriterion("${param["sName"]} is not null");
            return (Criteria) this;
        }

        public Criteria and${param["jFname"]}EqualTo(${param["jType"]} value) {
            addCriterion("${param["sName"]} =", value, "${param["jName"]}");
            return (Criteria) this;
        }

        public Criteria and${param["jFname"]}NotEqualTo(${param["jType"]} value) {
            addCriterion("${param["sName"]} ${r"<>"}", value, "${param["jName"]}");
            return (Criteria) this;
        }

        public Criteria and${param["jFname"]}GreaterThan(${param["jType"]} value) {
            addCriterion("${param["sName"]}${r" >"}", value, "${param["jName"]}");
            return (Criteria) this;
        }

        public Criteria and${param["jFname"]}GreaterThanOrEqualTo(${param["jType"]} value) {
            addCriterion("${param["sName"]}${r" >"}=", value, "${param["jName"]}");
            return (Criteria) this;
        }

        public Criteria and${param["jFname"]}LessThan(${param["jType"]} value) {
            addCriterion("${param["sName"]}${r" <"}", value, "${param["jName"]}");
            return (Criteria) this;
        }

        public Criteria and${param["jFname"]}LessThanOrEqualTo(${param["jType"]} value) {
            addCriterion("${param["sName"]}${r" <"}=", value, "${param["jName"]}");
            return (Criteria) this;
        }

        public Criteria and${param["jFname"]}In(List<${param["jType"]}> values) {
            addCriterion("${param["sName"]} in", values, "${param["jName"]}");
            return (Criteria) this;
        }

        public Criteria and${param["jFname"]}NotIn(List<${param["jType"]}> values) {
            addCriterion("${param["sName"]} not in", values, "${param["jName"]}");
            return (Criteria) this;
        }

        public Criteria and${param["jFname"]}Between(${param["jType"]} value1, ${param["jType"]} value2) {
            addCriterion("${param["sName"]} between", value1, value2, "${param["jName"]}");
            return (Criteria) this;
        }

        public Criteria and${param["jFname"]}NotBetween(${param["jType"]} value1, ${param["jType"]} value2) {
            addCriterion("${param["sName"]} not between", value1, value2, "${param["jName"]}");
            return (Criteria) this;
        }
        
        </#list>
    }

    /**
     */
    public static class Criteria extends GeneratedCriteria {

        protected Criteria() {
            super();
        }
    }

    public static class Criterion {
        private String condition;

        private Object value;

        private Object secondValue;

        private boolean noValue;

        private boolean singleValue;

        private boolean betweenValue;

        private boolean listValue;

        private String typeHandler;

        public String getCondition() {
            return condition;
        }

        public Object getValue() {
            return value;
        }

        public Object getSecondValue() {
            return secondValue;
        }

        public boolean isNoValue() {
            return noValue;
        }

        public boolean isSingleValue() {
            return singleValue;
        }

        public boolean isBetweenValue() {
            return betweenValue;
        }

        public boolean isListValue() {
            return listValue;
        }

        public String getTypeHandler() {
            return typeHandler;
        }

        protected Criterion(String condition) {
            super();
            this.condition = condition;
            this.typeHandler = null;
            this.noValue = true;
        }

        protected Criterion(String condition, Object value, String typeHandler) {
            super();
            this.condition = condition;
            this.value = value;
            this.typeHandler = typeHandler;
            if (value instanceof List<?>) {
                this.listValue = true;
            } else {
                this.singleValue = true;
            }
        }

        protected Criterion(String condition, Object value) {
            this(condition, value, null);
        }

        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
            super();
            this.condition = condition;
            this.value = value;
            this.secondValue = secondValue;
            this.typeHandler = typeHandler;
            this.betweenValue = true;
        }

        protected Criterion(String condition, Object value, Object secondValue) {
            this(condition, value, secondValue, null);
        }
    }
}